//
//  HTTTrippTableViewCell.m
//  HeartTravel
//
//  Created by lanou on 15/10/27.
//  Copyright © 2015年 陈文杰. All rights reserved.
//

#import "HTTTrippTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation HTTTrippTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _picture = [[UIImageView alloc]initWithFrame:CGRectMake(0, -60, SCREEN_WIDTH, 300)];
        
        [self.contentView addSubview:_picture];
        
        _view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 180)];
        _view.backgroundColor = [UIColor colorWithWhite:0.000 alpha:0.500];
        [self.contentView addSubview:_view];
        
        _label = [[UILabel alloc]initWithFrame:CGRectMake(15, 55, SCREEN_WIDTH - 30, 30)];
        _label.textAlignment = NSTextAlignmentCenter;
        _label.textColor = [UIColor whiteColor];
        [_view addSubview:_label];
        
        _icon = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 42 , 95, 20, 20)];
        _icon.image = [UIImage imageNamed:@"人头白色"];
        [_view addSubview:_icon];
        
        _jionLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 20 , 90, 80, 30)];
        _jionLabel.textColor = [UIColor whiteColor];
        _jionLabel.font = [UIFont systemFontOfSize:13];
        [_view addSubview:_jionLabel];
//        self.contentView.clipsToBounds = YES;
//        _picture.clipsToBounds = YES;
        
        //把多余的picture剪裁掉
        self.clipsToBounds = YES;
    }
    return self;
}

- (void)setTripMainModel:(HTTripMainModel *)tripMainModel
{
    _tripMainModel = tripMainModel;

    
    [_picture sd_setImageWithURL:[NSURL URLWithString:tripMainModel.relate_img]];
    
    _label.text = tripMainModel.experience_title;
    
    _jionLabel.text = [tripMainModel.apply_cnt stringByAppendingString:@"人参加"];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
